#!/bin/bash

SHOWTIMES=0
OPTIND=1
while getopts "h?v" opt; do
    case "$opt" in
        h|\?)
            echo "Usage: $0 [-v]"
            exit 0
            ;;
        v)
            SHOWTIMES=1
            ;;
    esac
done

run() {

    if [ "$SHOWTIMES" -eq 1 ]; then
        time "$@"
    else
        "$@"
    fi
}

run dig www.google.com
